package com.petrooil.core.service;

import com.petrooil.core.dao.PertoOilDocDao;
import com.petrooil.core.model.PetroOilDoc;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.io.Serializable;
import java.util.List;

@Service("petroOilDocService")
public class PetroOilDocService implements IPetroOilDocService {

    @Autowired
    private PertoOilDocDao petroOilDocDao;

    @Transactional
    @Override
    public PetroOilDoc create(PetroOilDoc petroOilDoc) {
        return petroOilDocDao.create(petroOilDoc);
    }

    @Transactional(readOnly = true)
    @Override
    public PetroOilDoc get(Serializable id) {
        return petroOilDocDao.get(id);
    }

    @Transactional
    @Override
    public PetroOilDoc update(PetroOilDoc petroOilDoc) {
        return petroOilDocDao.update(petroOilDoc);
    }

    @Transactional
    @Override
    public void delete(PetroOilDoc petroOilDoc) {
        petroOilDocDao.delete(petroOilDoc);
    }

    @Transactional(readOnly = true)
    @Override
    public List<PetroOilDoc> getPetroDocList(String department) {
        return petroOilDocDao.getPetroDocList(department);
    }

    @Override
    public long countTasks(String department) {
        return petroOilDocDao.countTasks(department);
    }
}
